<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
    <title>shoppingmall</title>
  </head>
  <body>
    <noscript>
      <strong>We're sorry but shoppingmall doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
    <script>
    (function (win) {
        var docEl = win.document.documentElement;
        var time;

        function refreshRem() {
          var width = docEl.getBoundingClientRect().width;
          if (width > 768) { // 最大宽度
            width = 768;
          }
          var rem = width / 375 * 100;
          docEl.style.fontSize = rem + 'px';
          ///rem用font-size:50px来进行换算

        }

        win.addEventListener('resize', function () {
          clearTimeout(time);
          time = setTimeout(refreshRem, 1);
        }, false);
        win.addEventListener('pageshow', function (e) {
          if (e.persisted) {
            clearTimeout(time);
            time = setTimeout(refreshRem, 1);
          }
        }, false);

        refreshRem();

      })(window);
    </script>
  </body>
</html>
